/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package za.ac.cput.car;

/**
 *
 * @author Zeus
 */
public class CarImpl implements Car {

    private double distanceTravelled = 0;
    private double litresRemaining = 20;
    private final static double costPerLitre = 5.00;
    private final static double usagePerKm = 0.5;

    @Override
    public void drive(double distanceKM) {
        if (distanceKM < (litresRemaining / usagePerKm)) {
            distanceTravelled += distanceKM;
            litresRemaining = litresRemaining - (usagePerKm * distanceKM);
        } else {
            System.out.println("There is not enough petrol to travel that far");
        }
    }

    @Override
    public void fillTank(double amountPaid) {
        litresRemaining = litresRemaining + (amountPaid / costPerLitre);
    }

    @Override
    public double checkTank() {
        return litresRemaining;
    }

    @Override
    public double checkDisctanceTravelled() {
        return distanceTravelled;
    }
}
